package cn.iocoder.yudao.module.mqtt.dal.mysql.commport;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mqtt.dal.dataobject.commport.CommPortDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mqtt.controller.admin.commport.vo.*;

/**
 * 通讯口配置 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface CommPortMapper extends BaseMapperX<CommPortDO> {

    default PageResult<CommPortDO> selectPage(CommPortPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CommPortDO>()
                .likeIfPresent(CommPortDO::getPortName, reqVO.getPortName())
                .eqIfPresent(CommPortDO::getBaudRate, reqVO.getBaudRate())
                .eqIfPresent(CommPortDO::getDataBits, reqVO.getDataBits())
                .eqIfPresent(CommPortDO::getParity, reqVO.getParity())
                .eqIfPresent(CommPortDO::getFlowControl, reqVO.getFlowControl())
                .eqIfPresent(CommPortDO::getSubTopics, reqVO.getSubTopics())
                .eqIfPresent(CommPortDO::getDescription, reqVO.getDescription())
                .betweenIfPresent(CommPortDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CommPortDO::getId));
    }

    List<CommPortDO> selectSimpleList();
}